package tjs.study.notes.remember.tulin.jvm.demoCode;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class User {
	public static List<Object> getAwayGC = new ArrayList<>(8);

	private int id;
	private String name;
	
	public User(int id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@Override
	protected void finalize() throws Throwable {
		// finalize（）方法是对象脱逃死亡命运的最后一次机会
		System.out.println("id:"+id+", 回收前回调finalize首次标记");
		getAwayGC.add(this);
	}
}
